package com.example.demo.common;

import org.springframework.util.StringUtils;

public class StringTools {

    public static String subLength(String val,int length) {
        if(!StringUtils.hasLength(val) || length <= 0) return val;
        if(val.length() <= length) return val;
        return val.substring(0,length);
    }
}
